DECLARE @ADVENTURECONT TABLE (ID INT IDENTITY(1,1), NOMBRE VARCHAR(100),CANTIDAD Bigint)

DECLARE @QRY NVARCHAR(MAX)
        ,@TABLA NVARCHAR(100)
		,@COUNT INT 

DECLARE QTABLAS CURSOR FOR 
        SELECT TABLA FROM (SELECT SIS.NAME + QUOTENAME(TAB.NAME) AS 'TABLA' FROM sys.tables AS TAB
		                             JOIN sys.schemas AS SIS ON TAB.schema_id = SIS.schema_id) AS CUR

OPEN QTABLAS 
FETCH NEXT FROM QTABLAS INTO @TABLA
WHILE @@FETCH_STATUS = 0
BEGIN 
SET @QRY = N'SELECT @COUNT=COUNT(*) FROM ' + QUOTENAME (@TABLA)
EXEC sp_executesql @QRY, N'@COUNT INT OUTPUT', @COUNT = @COUNT OUTPUT
INSERT INTO @ADVENTURECONT
VALUES(@TABLA, @COUNT)
FETCH NEXT FROM QTABLAS INTO @TABLA 
END 
CLOSE QTABLAS 


SELECT * FROM @ADVENTURECONT
